package Conexao;

import java.net.Socket;
import java.io.*;


import negocio.Requisicao;


public class ChecagemConexaoAnswer implements Runnable {

	private Socket socket;

	public ChecagemConexaoAnswer(Socket socket){

		this.socket=socket;
	}

	public void run() {
		try{
			while(!socket.isClosed()){

				socket.setSoTimeout(10000);

				ObjectOutputStream out= new ObjectOutputStream(socket.getOutputStream()); 
				ObjectInputStream in= new ObjectInputStream(socket.getInputStream());
				Requisicao requisicao= new Requisicao(null, null, 1);

				in.readUnshared();

				out.writeUnshared(requisicao);

			}
		}catch(Exception e){
			
			System.out.println("Fim de conexao com o IP"+socket.getInetAddress().getHostAddress());
		}
	}
}
